import request from '@/utils/request';

export async function getTeamInfoByPage(params: any) {
  return request('/api/project/getTeamInfoByPage', {
    method: 'POST',
    data: params,
  });
}

export async function getRole(params: any) {
  return request('/api/project/getRoleType', {
    method: 'POST',
  });
}

export async function getAllUser(params: any) {
  return request('/api/system/getUserByPage', {
    method: 'POST',
  });
}

export async function getUserInfoSimp(params: any) {
  return request('/api/project/getUserInfoSimp', {
    method: 'POST',
    data: params,
  });
}

//根据角色类别获取用户/api/project/getUserNameAndIdByRoleType
export async function getUserByRoleType(params: any) {
  return request('/api/project/getUserNameAndIdByRoleType', {
    method: 'POST',
    params: {
      RoleName: params,
    },
  });
}

//根据用户类别添加addTeamInfoByRoleType
export async function addTeamInfoByRoleType(params: any) {
  return request('/api/project/addTeamInfoByRoleType', {
    method: 'POST',
    data: params,
  });
}

export async function addTeamInfo(params: any) {
  return request('/api/project/addTeamInfo', {
    method: 'POST',
    data: params,
  });
}

//分页查询/api/project/getAllTeamInfosByRoleType
export async function getAllTeamInfosByRoleType(para: any) {
  return request('/api/project/getAllTeamInfosByRoleType', {
    method: 'POST',
    params: {
      teamId: para,
    },
  });
}

///api/project/updateTeamInfosByRoleType
export async function updateTeamInfosByRoleType(para: any) {
  return request('/api/project/updateTeamInfosByRoleType', {
    method: 'POST',
    data: para,
  });
}

//删除/api/project/delTeamInfosByRoleType
export async function delTeamInfosByRoleType(para: any) {
  console.log(para, 'paraa');
  return request('/api/project/delTeamInfosByRoleType', {
    method: 'POST',
    params: {
      roleType: para.roleType,
      teamId: para.teamId,
    },
  });
}

//删除某一团队成员
export async function delOneTeamMember(para: any) {
  return request('/api/project/delOneTeamMember', {
    method: 'POST',
    params: {
      teamId: para.teamId,
      userId: para.userId,
      roleId: para.roleId,
    },
  });
}

export async function updateTeamInfo(params: any) {
  return request('/api/project/updateTeamInfo', {
    method: 'POST',
    data: params,
  });
}

export async function delTeamInfo(params: any) {
  return request('/api/project/delTeamInfo', {
    method: 'POST',
    data: params,
  });
}
export default { getTeamInfoByPage, addTeamInfo, updateTeamInfo, delTeamInfo };
